import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import axios from 'axios';
import VueParticles from 'vue-particles'

Vue.use(VueParticles)  
axios.defaults.baseURL = "http://localhost:8080"

//运行cookie跨域，但是部分浏览器不允许跨域，加了也没用
axios.defaults.withCredentials = true;

// 添加响应拦截器
axios.interceptors.response.use(function(response) {
	// 对响应数据做点什么
	if (response.data.code == 405) {
		localStorage.removeItem("com.woniu-account");
		router.push("/");
	} else if (response.data.code == 403) {
		router.push("/about");
	} else return response;
});





//把axios对象放到Vue的原型上面做复用
Vue.prototype.$http = axios;


Vue.use(ElementUI);

Vue.config.productionTip = false

new Vue({
	router,
	render: h => h(App)
}).$mount('#app')
